package com.sline.exception;

public class Demo1_Exception {
    public static void main(String[] args) {
        int[] arr = {11, 22, 33, 44, 55};

        // ArrayIndexOutOfBoundsException: 数组索引越界异常
//        System.out.println(arr[10]);

        // NullPointerException: 空指针异常
//        arr = null;
//        System.out.println(arr[0]);

        // ArithmeticException: 算术异常, 当出现异常的运算条件时, 抛出此异常, 例如一个整数除以零时.
        Demo d = new Demo();
        int x = d.div(10, 0);
        System.out.println(x);
    }

}

class Demo {
    // 出发运算
    public int div(int a, int b) {
        return a / b;
    }
}